<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<body>
  
  <script>
    var num1 = 123
    var age = 18
    var isAdmin = true

    // 1.转换方式一: 隐式转换(用的非常多)
    var num1Str = num1 + ""
    var ageStr = age + ""
    var isAdminStr = isAdmin + ""
    console.log(typeof num1Str, typeof ageStr, typeof isAdminStr) // => string string string


    // 2.转换方式一: 显示转换
    // var num1Str2 = String(num1)
    var num1Str2 = num1.toString()
    console.log(typeof num1Str2) // => string

  </script>

</body>
</html>